package com.hello;

import java.util.Arrays;
import java.util.Random;

public class arrTest2 {
    public static void main(String [] args){
        int [] arr=new int[10];
        Random r=new Random();
        for (int i = 0; i < arr.length; i++) {
            int number=r.nextInt(100)+1;
            arr[i]=number;
            
        }
//        for (int i = 0; i < arr.length; i++) {
//            System.out.println(arr[i]);
//
//        }
        int sum=0;
        for (int i = 0; i < arr.length; i++) {
            sum+=arr[i];
        }
        System.out.println("数组中所有数据的和为："+sum);
        int avg=sum/arr.length;
        System.out.println("数组中所有数的平均和为"+avg);
        int count=0;
        for (int i = 0; i < arr.length; i++) {
            if(arr[i]<avg)
                count++;
        }
        System.out.println("在数组中一共有"+count+"个数据，比平均数小");
    }
}
